package com.zzxy.spingmvc34.controller;

import com.zzxy.spingmvc34.po.Student;
import com.zzxy.spingmvc34.po.StudentExt;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/stu")
public class StudentController {
    @RequestMapping("register.do")
    public String register(){
        return "/user/register";

    }
    @RequestMapping("addStu")
    public String addStudent(String usernmae, String password, Model model){
        System.out.println(usernmae);
        System.out.println(password);
        model.addAttribute("username",usernmae);
        model.addAttribute("password",password);
        return "/user/userList";

    }

    @RequestMapping("addStu1")
    public String addStudent1(Student student){
        System.out.println(student);
        return "/user/userList";
    }
    @RequestMapping("addStu2")
    public String addStudent2(StudentExt ext){
     //  System.out.println(ext.getStudent());
       /*for(Student student :ext.getStudentList()){
           System.out.println(student);
        }*/
        System.out.println(ext);
        return "/user/userList";
    }
    @RequestMapping("test")
    public  String test(){
        return("forward: register.do");
    }
}
